<template>
  <view class="container">
    <view class="box">
      <view class="kong_border"></view>
      <view class="border">
        <view class="border_top flexs2">
          <image @click="backHandler"
                 class="back_image"
                 src="../../static/image/ico_dh_bk@2x.png"
                 mode=""></image>
          <view class="topbiao">提问</view>
          <view class="text-center"
                @click="totiwen">
            <image class="tiwen_image"
                   src="../../static/image/mqpj_ico_tw@2x.png"
                   mode=""></image>
            <view class="tiwen_text">提问</view>
          </view>
        </view>
      </view>
      <!-- <view class="nothing text-center">
        <image src="../../static/image/ss_img_k@2x.png"
               mode=""></image>
        <view class="text_no">暂无信息</view>
      </view> -->
      <scroll-view class="pingjia"
                   :scroll-y="true"
                   lower-threshold="50"
                   @scrolltolower="lowerY">
        <view class="pingjia_list"
              v-for="item in questionList"
              :key="item.id"
              @click="totiwencenter(item.id)">
          <view class="pingjia_top flexs1">
            <image :src="item.user.avatar?$serverIp+item.user.avatar:'../../static/image/gexx_img_mrtx@2x.png'"
                   mode=""></image>
            <view class="">
              <view class="pingjia_user">{{item.user.nickname}}</view>
              <view class="pingjia_minut">{{item.createtime}}</view>
            </view>
          </view>
          <view class="flexs1">
            <view class="pingjia_pjia">{{item.title}}</view>
          </view>
          <view class="pingjia_center">{{item.content}}</view>
        </view>
      </scroll-view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return { questionList: [], id: null }
  },
  onLoad(options) {
    this.id = options.id
    this.getQuestionList(options.id)
  },
  onShow() {
    this.getQuestionList(this.id)
  },
  methods: {
    totiwen() {
      uni.navigateTo({
        url: 'tiwens?id=' + this.id
      })
    },
    //Curriculum/question_list
    async getQuestionList(id) {
      const { data } = await this.$http.post('/Curriculum/question_list', { page: 1, pageSize: 10, c_id: id })
      console.log(data)
      this.questionList = data.data
    },
    backHandler() {
      uni.navigateBack({
        delta: 1
      })
    }
  }
}
//item.user.avatar?urls+item.user.avatar:'../../static/image/gexx_img_mrtx@2x.png'
</script>

<style>
.flexs1 {
  display: flex;
  justify-content: flex-start;
}
.flexs2 {
  display: flex;
  justify-content: space-between;
}
.box {
  width: 100%;
  height: 100%;
  background-color: #f5f5f5;
  color: #333333;
  overflow-y: hidden;
}

.kong_border {
  width: 100%;
  height: var(--status-bar-height);
  background-color: #ffffff;
}
.topbiao {
  font-size: 36rpx;
  color: #333333;
  margin-top: 10rpx;
}

.nothing {
  margin-top: 200rpx;
}

.nothing image {
  width: 354rpx;
  height: 253rpx;
}

.text_no {
  color: #666666;
  font-size: 26rpx;
  margin-top: 15rpx;
}

.border_top {
  width: 100%;
  height: 100rpx;

  /* line-height: 100rpx; */
  padding: 15rpx 30rpx;
  background-color: #ffffff;
}

.back_image {
  width: 20rpx;
  height: 36rpx;
  margin-top: 15rpx;
}

.tiwen_image {
  width: 36rpx;
  height: 36rpx;
}
.tiwen_text {
  font-size: 22rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #333333;
}

/* pingjia */
.pingjia {
  width: 100%;
  padding: 20rpx 30rpx;
  height: calc(100% - 120rpx);
  background-color: #ffffff;
  margin-top: 20rpx;
}

.pingjia_pjia {
  margin: 10rpx 0 20rpx 0;
  font-size: 30rpx;
  font-weight: bold;
}

.pingjia_list {
  width: 100%;
  margin-top: 10rpx;
}

.pingjia_center {
  font-size: 28rpx;
}

.pingjia_user {
  font-size: 30rpx;
}

.pingjia_minut {
  font-size: 24rpx;
  color: #999999;
}

.image_next {
  width: 12rpx;
  height: 22rpx;
}

.pingjia_more {
  color: #666666;
  font-size: 22rpx;
  margin-right: 10rpx;
}

.pingjia_top {
  width: 100%;
  height: 100rpx;
}

.pingjia_top image {
  width: 70rpx;
  height: 70rpx;
  border-radius: 50%;
  margin-right: 20rpx;
}
</style>
